package com.distributedDataBase.controller;

import com.distributedDataBase.pojo.DateDemo;
import com.distributedDataBase.pojo.Result;
import com.distributedDataBase.service.DateDemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("dates")
public class DateDemoController {

    @Autowired
    private DateDemoService dateDemoService;

    @PostMapping("dateDemo")
    public Result dateDemo(@RequestBody DateDemo dateDemo) {
        System.out.println(dateDemo);
        int count = dateDemoService.register(dateDemo);
        if (count > 0) {
            return new Result("200", "注册成功");
        }
        return new Result("500", "注册失败");
    }
}
